package com.qf.controller;

import com.qf.entity.Todolist;
import com.qf.service.TodolistService;
import com.qf.vo.R;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * 事项计划(Todolist)表控制层
 *
 */
@RestController
@RequestMapping("todolist")
@Tag(name = "事项计划")
public class TodolistController {
    /**
     * 服务对象
     */
   @Resource
    private TodolistService todolistService;

    /**
     * 新增事项计划
     * @param todolist
     * @return
     */
   @PostMapping("addTodolist")
   public R addTodolist(@RequestBody Todolist todolist){



       return  R.ok(todolistService.addTodolist(todolist));

   }

    /**
     * 删除事项计划
     * @param id
     * @return
     */
    @GetMapping("delectById")
   public R delectById(Integer id){


       return R.ok(todolistService.delectById(id));
   }


    /**
     * 修改事项计划
     * @param todolist
     * @return
     */
    @GetMapping("updeteById")
    public R updeteById(Todolist todolist){



        return todolistService.updeteById(todolist);
    }

    /**
     * 根据type来查询
     * @param type
     * @return
     */
    @GetMapping("slectBytype")
    public R slectByAll(String type){


        return  todolistService.slectBytype(type);
    }








}

